package teshop.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import teshop.data.dao.CustomerDAO;
import teshop.data.domain.Customer;
import teshop.service.CustomerService;


/**
 * Customer service implementation using Spring 2.5
 * 
 * @author Hryhory Lira (TietoEnator Java Developer)
 *
 */
@Service
public class CustomerServiceImpl implements CustomerService {
	
	private CustomerDAO customerDAO;

	@Autowired
	public CustomerServiceImpl(CustomerDAO customerDAO) {
		this.customerDAO = customerDAO;
	}

	public void addCustomer(Customer customer) {
		customerDAO.save(customer);
	}

	@Override
	public boolean authorize(String login, String password) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void editCustomer(Customer customer) {
		customerDAO.update(customer);		
	}

	public List<Customer> getCustomerList() {
		return customerDAO.getAll();
	}

}
